const {app, BrowserWindow, ipcMain} = require('electron');
const path = require("node:path");

const mainWindow = ()=> {
    let win = new BrowserWindow({
        width: 800,
        height: 600,
        webPreferences: {
            preload: path.join(__dirname, './preload.js')
        }
    })
    win.loadFile('./page/index.html');
    ipcMain.on('open-dev-tools', ()=> {
        win.webContents.openDevTools();
    })
    ipcMain.on('close-dev-tools', ()=> {
        win.webContents.closeDevTools();
    })
    ipcMain.handle('get-version', ()=> {
        return process.versions;
    })

}

app.whenReady().then(()=> {
    mainWindow();
})
